package tech.aistar.service.impl.noteinfo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import tech.aistar.mapper.noteinfo.INotePayMapper;
import tech.aistar.service.noteinfo.INotePayService;


/**
 * Created by lenovo on 2019/10/10.
 */
@Service
@Transactional
public class NotePayServiceImpl implements INotePayService {

    @Autowired
    private INotePayMapper notePayMapper;

    /**
     * 散列的订单数据 - 保存到数据库中
     * @param userId
     * @param orderNum
     * @param payNum
     * @param money
     * @param orderTime
     * @param noteId
     * @param noteName
     */
    @Override
    public void updateOrderStatus(Integer userId, String orderNum, String payNum, Double money, String orderTime, Integer noteId, String noteName) {
        System.out.println("调用存储");
        notePayMapper.updateOrderStatus(userId,orderNum,payNum,money,orderTime,noteId,noteName);
    }

    /**
     * 根据用户Id和文章Id
     * 查询用户对应的订单编号是否下单
     * @param userId
     * @param noteId
     * @return
     */
    @Override
    public Integer findOrderIdById(Integer userId, Integer noteId) {
        return notePayMapper.findOrderIdById(userId, noteId);
    }
}
